
% C_11 = 13.4193;  % 根据需要设置
% C_12 = -8.9851;  % 根据需要设置
% C_2 = 26.6139;   % 根据需要设置
c = 3.587;
% C_11=6.7639;
% C_12 = 0.2582;
% C_2 = 28.4932;
C_11 = -0.7347; C_12 = 11.6264; C_2 = 29.7988;
% 定义函数 f(r, z) 和 g(r, z)
f = @(r, z) -abs(z).*log(sqrt(r.^2 + (c + abs(z)).^2) + c + abs(z)) ...
             - abs(z).*log(sqrt(r.^2 + (c - abs(z)).^2) - (c - abs(z))) ...
             + 2*abs(z).*log(sqrt(r.^2 + z.^2) + abs(z)) ...
             + sqrt(r.^2 + (c - z).^2) + sqrt(r.^2 + (c + z).^2) - 2*sqrt(r.^2 + z.^2);

g = @(r, z) log(sqrt(r.^2 + (c + abs(z)).^2) + c + abs(z)) ...
             - log(sqrt(r.^2 + (c - abs(z)).^2) - (c - abs(z)));
r = linspace(-30, 30, 200);  % 在 [0, 20] 范围内生成200个点
z = linspace(-30, 30, 200);  % 在 [0, 20] 范围内生成200个点
[R, Z] = meshgrid(r, z);   % 创建二维网格

% 计算 evl(r, z) 的值
Evl = C_11 * f(R, Z) +C_12 * g(R, Z) + C_2;

% 绘制等高图
figure;
contourf(R, Z, Evl, linspace(50, 55,20));  % linspace 生成20个从30到100的区间
colorbar;  % 显示色标
%contourf(R, Z, Evl, 100);
%contour(R, Z, Evl, [30,30,80]);  % 绘制20条等高线[条数,low,upper]
colorbar;  % 显示色标
xlabel('r');  % x轴标签
ylabel('z');  % y轴标签
title('3号等高图：evl(r, z)');  % 图表标题
% 保证横纵坐标比例一致
axis equal;  % 确保x和y轴比例相同

% z_intercept = fzero(@(z) C_11 * f(0, z) + C_12 * g(0, z) + C_2 - 55, 5);  % 初始猜测值为5
% fprintf('r=0时的截距 (z = %.4f)\n', z_intercept);
% _intercept = fzero(@(z) C_11 * f(0, z) + C_12 * g(0, z) + C_2 - 55, 5);  % 初始猜测值为5
% fprintf('r=0时的截距 (z = %.4f)\n', z_intercept);